//
// Created by Jisam on 23/10/2024 22:08.
// Solution of  template
#include <bits/stdc++.h>

#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;

signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n + 1),b(n,0);
    for(int i = 1; i <= n; i ++) cin >> a[i];
    sort(all(a));
    int ans = 0;

    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= n ; j ++){
            if(a[j] >= i && b[j] == 0){
                ans ++;
                b[j] = 1;
                break;
            }
        }
    }
    cout << ans;
    return 0;
}